package cn.com.dcsgo.statics;

import cn.com.dcsgo.Calculator;

/**
 * StaticProxyCalculator
 *
 * @author Dcsgo
 * @since 2025/2/6 10:13
 */

public class StaticProxyCalculator implements Calculator {
    private final Calculator calculator;

    public StaticProxyCalculator(Calculator calculator){
        this.calculator=calculator;
    }

    @Override
    public int add(int i, int j) {
        System.out.println("i = " + i + ", j = " + j);
        int result=calculator.add(i,j);
        System.out.println("result = " + result);
        return result;
    }

    @Override
    public int sub(int i, int j) {
        System.out.println("i = " + i + ", j = " + j);
        int result=calculator.sub(i,j);
        System.out.println("result = " + result);
        return result;
    }

    @Override
    public int mul(int i, int j) {
        System.out.println("i = " + i + ", j = " + j);
        int result=calculator.mul(i,j);
        System.out.println("result = " + result);
        return result;
    }

    @Override
    public int div(int i, int j) {
        System.out.println("i = " + i + ", j = " + j);
        int result=calculator.div(i,j);
        System.out.println("result = " + result);
        return result;
    }
}
